<%@ page contentType="text/html;charset=utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>北京科技大学宿舍管理系统</title>
		<style type="text/css">
<!--
.content {
	background-color: #086fba;
	width: 1200px;
	height: 650px;
	background-image: url(./images/loginbg.jpg);
	margin: 0 auto;
	position: absolute;
}

.input {
	height: 100px;
	width: 170px;
	margin-left: 330px;
	margin-top: 230px;
}

input {
	border: 0px;
	background-color: none;
	background: transparent;
	font-family: "黑体";
	font-size: 17px;
	font-weight: bold;
}

body {
	background-color: #086fba;
}

#login {
	height: 75px;
	width: 78px;
	position: absolute;
	top: 232px;
	left: 517px;
	font-size: 70px;
	cursor:hand;
}
-->
</style>

		<Script language="javaScript">

function $(str){
	return document.getElementById(str);
}

function UsrLoginFrm_Validator()
{
  if($("username").value == "")
  {
    alert("请在用户名输入框中输入值。");
    $("username").focus();
    return (false);
  }
   if ($('password').value == "")
  {
    alert("请在密码输入框中输入值。");
    $("username").focus();
    return (false);
  }

  if ($("username").value.length < 1)
  {
    alert("在用户名输入框中，请至少输入 1 个字符。");
  	$("username").focus();
    return (false);
  }

  if ($("username").value.length > 30)
  {
    alert("在用户名输入框中，请最多输入 30 个字符。");
    $("username").focus();
    return (false);
  }
  
   if ($("password").value.length >20)
  {
    alert("在密码输入框中，请最多输入 10 个字符。");
    $("password").focus();
    return (false);
  }
  		
 // var	vUser=theForm.userName.value;
  //var	vPwd =theForm.password.value;
  //LoginDirectUp(vUser,vPwd);

  return true;
}

function UsrLoginEvnt(frmObj)
{
	if (frmObj==null) 
		return false;
	if (UsrLoginFrm_Validator()==false)
		return false;
	//var	vUser=frmObj.userName.value;
	//var	vPwd =frmObj.password.value;
	//LoginDirect(vUser,vPwd);
	frmObj.submit();
	return true;
}

function init()
{
	document.getElementById("username").focus();
	
}

document.onkeydown = function (e){  
     var theEvent = window.event || e;  
     var code = theEvent.keyCode || theEvent.which;  
     if(code == 13){  
   		UsrLoginEvnt($('UsrLoginFrm'));
     }  
}
</script>

	</head>

	<body onLoad="init();" >
		<div class="content">
			<FORM method="post" id="UsrLoginFrm" name="UserLoginFrm" action="login.action">
				<div class="input">
					<table width="170" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="30">
								<input id="username" name="userName" id="username" type="text" size="15" value="" />
							</td>
						</tr>
						<tr>
							<td height="15">
								&nbsp;
							</td>
						</tr>
						<tr>
							<td height="30">
								<input  id ="password" name="password" type="password" size="22"
									style="font-size: 12px;" value="" />
							</td>
						</tr>
					</table>
				</div>
				<img id="login" src="./images/login_button.jpg" onclick="UsrLoginEvnt($('UsrLoginFrm'))" />
			</FORM>
			<div style="margin-left:200px">
				<s:actionerror cssStyle="color:red;"  />
			</div>
		</div>
	</body>
</html>
